<template>
  <div class="ctow">
    <h2>第二个组件</h2>
    <button @click="countadd">+10</button>
    <button @click="countadd1">+20</button>
    <p>{{$store.state.count}}</p>
  </div>
</template>

<script>
export default {
  name: "CTow",
  methods:{
    countadd(){
      this.$store.commit('countAdd',{num:10});
    },
    countadd1(){
      this.$store.commit({type:'countAdd',num:20});
    }
  }
}
</script>

<style scoped>
  .ctow{
    width: 100%;
    height: 80%;
    background-color: #7d7d7d;
  }
</style>